package com.itheima.reggie.common;
/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录用户id
 */
public class BaseContext {
    //本地线程变量
    private static ThreadLocal<Long> threadLocal=new ThreadLocal<>();

    //设置线程局部变量的值
    public  static void currentSetId(Long id){
        threadLocal.set(id);
    }
    //获取线程局部变量的值
    public static Long currentGetId(){
        return threadLocal.get();
    }
}
